/*
 * Renders all templates to the browser using FreeMarker
 */
package ui;

import freemarker.template.*;
import java.io.*;

/**
 *
 * @author Jimmy
 */
public class TemplateRenderer {

    public static final String TEMPLATE_DIR = "/home/majors/lipham/tradeu-templates/";
    
    public static Template GetTemplate(String templateName)
    {
        Template t;
        try
        {
            Configuration cfg = new Configuration();
            cfg.setDirectoryForTemplateLoading(new File(TEMPLATE_DIR));
            cfg.setObjectWrapper(new DefaultObjectWrapper());
            t = cfg.getTemplate(templateName);
        }
        catch (Exception e)
        {
            return null;
        }
        return t;
    }
}
